<template>
  <div class="createPost-container">
    <el-form ref="postForm" :model="noticeDetailForm" :rules="rules"  label-width="120px" class="form-container">
      <div class="createPost-main-container">
        <el-row>
          <el-col :span="24">
            <el-form-item style="margin-bottom: 20px;"  label="故障Id:"> : {{noticeDetailForm.id}} </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item style="margin-bottom: 20px;"  label="仓库名称:"> {{noticeDetailForm.room_name}} </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item style="margin-bottom: 20px;" label="商户名称:" >  {{noticeDetailForm.customer_name}} </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-form-item style="margin-bottom: 20px;" label="isnotice:" > {{noticeDetailForm.isnotice}} </el-form-item>
        </el-row>
        <el-row>
          <el-form-item style="margin-bottom: 20px;" label="isread:" >  {{noticeDetailForm.isread}} </el-form-item>
        </el-row>

        <el-row>
          <el-form-item style="margin-bottom: 20px;" label="故障编码:" >  {{noticeDetailForm.fault_code}} </el-form-item>
        </el-row>
        <el-row>
          <el-form-item style="margin-bottom: 20px;" label="故障编码值:" >  {{noticeDetailForm.fault_value}} </el-form-item>
        </el-row>

        <el-row>
          <el-form-item style="margin-bottom: 20px;" label="内容:" >  {{noticeDetailForm.content}} </el-form-item>
        </el-row>
        <el-row>
          <el-form-item style="margin-bottom: 20px;" label="创建时间:" >  {{noticeDetailForm.createdt}} </el-form-item>
        </el-row>
      </div>
    </el-form>
  </div>
</template>

<script>
import { noticedetail } from '@/api/notice'
import { userSearch } from '@/api/remoteSearch'


const defaultForm = {
  id:'',
  control_id: '',
  notice_id: '',
  customer_id: '',
  faultValue: '',
  faultCode:'',
  userIds:'',
  isread: '',
  isdeal: '',
  isnotice: '',
  readtime: '',
  status: 1,
  createTime: '',
  type: '',
  level:''
}

export default {
  name: 'noticedetail',
  components: {   },
  props: {
    isEdit: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      noticeDetailForm: Object.assign({}, defaultForm),
      loading: false,
      userListOptions: [],
      rules: {

      }
    }
  },
  computed: {
    contentShortLength() {
      return this.noticeDetailForm.content_short.length
    }
  },
  created() {
    const id = this.$route.query && this.$route.query.id
    this.fetchData(id)
  },
  methods: {
    fetchData(id) {
      noticedetail({ id: id }).then(response => {
        this.noticeDetailForm = response.data.data
        console.log(this.noticeDetailForm)
      }).catch(err => {
        console.log(err)
      })
    },
    getRemoteUserList(query) {
      userSearch(query).then(response => {
        if (!response.data.items) return
        this.userListOptions = response.data.items.map(v => v.name)
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.createPost-container {
  position: relative;
  .createPost-main-container {
    padding: 40px 45px 20px 50px;
    .postInfo-container {
      position: relative;
      @include clearfix;
      margin-bottom: 10px;
      .postInfo-container-item {
        float: left;
      }
    }
    .editor-container {
      min-height: 500px;
      margin: 0 0 30px;
      .editor-upload-btn-container {
        text-align: right;
        margin-right: 10px;
        .editor-upload-btn {
          display: inline-block;
        }
      }
    }
  }
  .word-counter {
    width: 40px;
    position: absolute;
    right: -10px;
    top: 0px;
  }
}
</style>
